﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dict.DataModel;
using UnityEngine;

namespace Dict.Blo
{
    class DictUnionFightTransferBlo
    {
        static public TableUnionFightTransfer GetOne(string id)
        {
            return Dict.DictDataManager.Instance.tableUnionFightTransferDao.GetById(id);
        }

        static public List<TableUnionFightTransfer> GetAll()
        {
            return Dict.DictDataManager.Instance.tableUnionFightTransferDao.CacheList;
        }

        static public Vector3 GetPosition(string id)
        {
            var trans = GetOne(id);
            if(trans!=null)
            {
                var posStr = trans.TransferStart;
                if(!string.IsNullOrEmpty(posStr))
                {
                    var sss = posStr.Trim().Split(new char[1] { ',' }, System.StringSplitOptions.RemoveEmptyEntries);
                    var x = float.Parse(sss[0]);
                    var y = float.Parse(sss[1]);
                    var z = float.Parse(sss[2]);

                    return new Vector3(x, y, z);
                }
            }

            return Vector3.zero;
        }
    }
}
